package serverlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import connectDB.IDB;
import connectDB.PacketDB;
import entities.Packetentities;

/**
 * Servlet implementation class Packetcontrol
 */
@WebServlet("/Packetcontrol")
public class Packetcontrol extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Packetcontrol() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String link = "/Manager/Packetlist.jsp";
		IDB<Packetentities, Boolean, String> pack = new PacketDB();
		List<Packetentities> list= new ArrayList<Packetentities>();
		list = pack.findAll();
		request.setAttribute("listpacket", list);
		String url = link;
		RequestDispatcher rd = request.getRequestDispatcher(url);
		rd.forward(request, response);
		
		
	}

}
